<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.util.Info"%>
<%@page import="com.dao.CommonDAO"%>
<%@page import="com.util.PageManager"%>
<%@page import="com.model.Sysuser"%>
<%@page import="com.model.Notice"%>
<%@page import="com.model.Familyda"%>
<%@page import="com.model.Familycy"%>
<%@page import="com.model.Tjreport"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理页面</title>
<!-- 调用CSS，JS -->
<link href="/wearablehealthymonitorsys/admin/images/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-family: "宋体";
	font-size: 12px;
	color: #333333;
	background-color: ;
}
.STYLE1 {
	color: #333333;
	font-size: x-large;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
<script language="javascript">
function window.onload() { 

if(top.location != self.location){ 

var a = window.parent.document.getElementsByTagName('iframe'); 

for (var i=0; i<a.length; i++){ 

if (a[i].name == self.name) {a[i].height = document.body.scrollHeight+320; return;}}} 
} 
</script>
<script language=javascript>
function show(no)
{
for(var i=1;i<20;i++)
{
var a = document.getElementById(no+"@"+i);
if(a==null)
{
continue;
}
if(a.style.display=="")
{
a.style.display="none";
}else{
a.style.display="";
}
}

}
</script>
<script type="text/javascript">
function showzhi(inn)
{
var a = document.getElementById("loca");
a.innerHTML=inn;
}
function change(no)
{
var c = document.getElementById("c");
c.innerHTML=no;
}
</script>

</head>
<body>
  <% 
  CommonDAO dao = (CommonDAO)Info.getDao(request,"CommonDAO");
  Sysuser user = (Sysuser)session.getAttribute("user"); 
  %>

  
	<form id="form1" name="form1" method="post" action="familycygl.jsp?f=f">

<br />


			<table width="100%">
				<tr>
					<td width="20%" valign="top">
						<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">
						<tr>
                          <td height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF">报告编号</td>
                          <td height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF">体检日期</td>
                          <td height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF"></td>
                            </tr>
					<%String cyid = request.getParameter("cyid");
					String bgno = request.getParameter("bgno")==null?"":request.getParameter("bgno");
					String did = request.getParameter("did")==null?"":request.getParameter("did");
					if(!did.equals("")){
						dao.delete(did,"Tjreport");
					}
					ArrayList<Tjreport> tjbglist = (ArrayList<Tjreport>)dao.findByHql("from Tjreport where cyid='"+cyid+"' order by savetime desc");
					for(Tjreport tjbg:tjbglist){
					%>
                          <tr>
                            <td height="26" align="center" bgcolor="#FFFFFF"><a href="report.jsp?bgno=<%=tjbg.getBgno() %>&cyid=<%=cyid %>"><%=tjbg.getBgno() %></a></td>
                            <td height="26" align="center" bgcolor="#FFFFFF"><%=tjbg.getSavetime().substring(0,10) %></td>
                            <td height="26" align="center" bgcolor="#FFFFFF">
                            <a href="tjreportedit.jsp?cyid=<%=cyid %>&id=<%=tjbg.getId() %>">改</a>|
                            <a href="report.jsp?cyid=<%=cyid %>&did=<%=tjbg.getId() %>">删</a></td>
                          </tr>
                        <%} %> 
						</table>  
						</td>
						<td width="80%" valign="top">
						<%
						if(!bgno.equals("")){
						Familycy cy = (Familycy)dao.findById(cyid,"Familycy");
						Tjreport bg = (Tjreport)dao.findByHql("from Tjreport where bgno='"+bgno+"'").get(0);
						%>
						<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">   
						<th colspan="4" height="27" align="center" background="/wearablehealthymonitorsys/admin/images/index1_72.gif" bgcolor="#FFFFFF">体检报告</th>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">姓名</td>
							<td align="center" bgcolor="#FFFFFF"><%=cy.getTname() %></td>
							<td align="center" bgcolor="#FFFFFF">性别</td>
							<td align="center" bgcolor="#FFFFFF"><%=cy.getSex() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">年龄</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getAge() %></td>
							<td align="center" bgcolor="#FFFFFF">身高</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getSg() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">体重</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getTz() %><%if(Double.valueOf(bg.getTz())>=90){ %><font color="red">[过重]</font> <%} %></td>
							<td align="center" bgcolor="#FFFFFF">视力</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getSl() %><%if(Double.valueOf(bg.getSl())<0.8){ %><font color="red">[注重用眼]</font><%} %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">听力</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getTl() %></td>
							<td align="center" bgcolor="#FFFFFF">血压</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getXy() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">呼吸系统是否正常</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getHxnote() %></td>
							<td align="center" bgcolor="#FFFFFF">有无先天异常病</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getYcbnote() %></td>
						</tr>
						<tr height="27">
							<td align="center" bgcolor="#FFFFFF">消化系统是否正常</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getXhxtnote() %></td>
							<td align="center" bgcolor="#FFFFFF">是否贫血</td>
							<td align="center" bgcolor="#FFFFFF"><%=bg.getIspx() %></td>
						</tr>
						<tr>
							<td align="center" bgcolor="#FFFFFF">其他</td>
							<td bgcolor="#FFFFFF" colspan="3"><%=bg.getOthernote() %></td>
						</tr>
						 </table>
						 <%} %>
			</td>
		</tr>
	</table>
	
	<table>
		<tr>
			<td>
			<script src="http://s1.bdstatic.com/r/www/cache/ecom/esl/1-6-10/esl.js"></script>
			<script type="text/javascript" src="/wearablehealthymonitorsys/admin/echarts.js"></script>  
			<script type="text/javascript" src="/wearablehealthymonitorsys/admin/jquery.js"></script>
			<div id="main1" style="height:400px;width:1000px "></div>
			<button type="button" id="button1">显示/隐藏</button>
			
			
			
			</td>
		</tr>
	</table>
	
	
</form>   
<script type="text/javascript">

		$(function() {
			$("#button1").click(function() {
				$("#main1").slideToggle(999);
			});
		});
		var xzhou = new Array();
		var actualPower = new Array();
		var expectedPower = new Array();
		var xylist = new Array();
		var cdllist = new Array();
		var dzlist = new Array();
		var hxlist = new Array();

		function refreshOnTime(){
			$.ajax({
				url : 'test.action?cyid=<%=cyid%>',
				type : 'GET',
				dataType : 'json',
				async : false,
				success : function(jsonArray) {
					for (x in jsonArray[0]) {
						xzhou[x] = jsonArray[0][x];
					}
					for (x in jsonArray[0]) {
						actualPower[x] = jsonArray[1][x];
					}
					for (x in jsonArray[0]) {
						expectedPower[x] = jsonArray[2][x];
					}
					for (x in jsonArray[0]) {
						xylist[x] = jsonArray[3][x];
					}
					for (x in jsonArray[0]) {
						cdllist[x] = jsonArray[4][x];
					}
					for (x in jsonArray[0]) {
						dzlist[x] = jsonArray[5][x];
					}
					for (x in jsonArray[0]) {
						hxlist[x] = jsonArray[6][x];
					}
				}
			});
			
		
		
		// 路径配置
		require.config({
			paths : {
				'echarts' : 'http://echarts.baidu.com/build/echarts',
				'echarts/chart/bar' : 'http://echarts.baidu.com/build/echarts'
			}
		});

		// 使用
		require([ 'echarts', 'echarts/chart/bar' // 使用柱状图就加载bar模块，按需加载
		], function(ec) {
			// 基于准备好的dom，初始化echarts图表
			var myChart = ec.init(document.getElementById('main1'));

			var option = {
				title : {
					text : '实时体征',
					subtext : ''
				},
				tooltip : {
					trigger : 'axis'
				},
				legend : {
					data : [ '体温', '脉搏', '血氧', '传导率', '电阻', '呼吸流量']
				},
				animation: false,
				toolbox : {
					show : true,
					feature : {
						mark : {
							show : true
						},
						dataView : {
							show : true,
							readOnly : false
						},
						magicType : {
							show : true,
							type : [ 'line']
						},
						restore : {
							show : true
						},
						saveAsImage : {
							show : true
						}
					}
				},
				calculable : true,
				xAxis : [ {
					type : 'category',
					data : xzhou
				} ],
				yAxis : [ {
					type : 'value'
				} ],
				series : [ {
					name : '体温',
					type : 'line',
					data : actualPower,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				}, {
					name : '脉搏',
					type : 'line',
					data : expectedPower,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '血氧',
					type : 'line',
					data : xylist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '传导率',
					type : 'line',
					data : cdllist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '电阻',
					type : 'line',
					data : dzlist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				},{
					name : '呼吸流量',
					type : 'line',
					data : hxlist,
					markPoint : {
						data : [ {
							type : 'max',
							name : '最大值'
						}, {
							type : 'min',
							name : '最小值'
						} ]
					}
				} ]
			};

			// 为echarts对象加载数据 
			myChart.setOption(option);
			//
		});
			setTimeout(refreshOnTime ,2000);
		}
		setTimeout(refreshOnTime ,2000);
	</script>

          
</body>
</html>
